<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>利润报表</title>
	<include file="Public:header" />
	<style type="text/css">
		.input{width:100px;border:1px solid #ccc;padding:2px;}
	</style>
    
    <script type="text/javascript">		
		var actflg="{:C('URL_MODEL')}"=="0"?"&":"?";
		
		window.onload=function()
		{
			window.print();
		}
	</script>

</head>
<body class="">

	<div class="list-box space-out-5px">
	
	<table id="misone_list_table" width="100%" border="1" cellspacing="0" cellpadding="0"><tbody>
    
    <tr height="25px">		
		<td field="col01">客户</td>
		<td field="col02">销售金额</td>
		<td field="col03">退货金额</td>
		<td field="col04">小计金额</td>
		<td field="col05">成本金额</td>
		<td field="col06">毛利</td>
		<td field="col07">毛利率</td>
	</tr>
    
    <php>$total_amount1=0;$total_amount2=0;$total_amount3=0;$total_cost=0;$total_profit=0;</php>
	<volist name="datalist" id="datalist">
	<tr height="22px">		
		<td field="col01">{$datalist.acc_title}</td>
		<td field="col02">{$datalist.amount1|get_round=###,2}<php>$total_amount1+=(double)$datalist['amount1'];</php></td>
		<td field="col03">{$datalist.amount2|get_round=###,2}<php>$total_amount2+=(double)$datalist['amount2'];</php></td>
		<td field="col04"><php>$amount3 = get_round((double)$datalist['amount1']-(double)$datalist['amount2'],2);echo $amount3;$total_amount3+=(double)$amount3;</php></td>
		<td field="col05">{$datalist.cost|get_round=###,2}<php>$total_cost+=(double)$datalist['cost'];</php></td>
		<td field="col06"><php>$profit = get_round((double)$amount3 - (double)$datalist['cost'],2);echo $profit;$total_profit+=(double)$profit;</php></td>
		<td field="col07"><php>echo get_round((double)$profit/(double)$amount3*100,2);</php>%</td>
	</tr>
	</volist>
    
    <tr height="25px">		
		<td field="col01">总计：</td>
		<td field="col02"><php>echo get_round($total_amount1,2);</php></td>
		<td field="col03"><php>echo get_round($total_amount2,2);</php></td>
		<td field="col04"><php>echo get_round($total_amount3,2);</php></td>
		<td field="col05"><php>echo get_round($total_cost,2);</php></td>
		<td field="col06"><php>echo get_round($total_profit,2);</php></td>
		<td field="col07"><php>echo get_round((double)$total_profit/(double)$total_amount3*100,2);</php>%</td>
	</tr>
    
	</tbody></table>
	
	</div>
	

</body>
</html>
